/*
 * @(#)XConstants.java        1.0 2000/05/09
 *
 * This file is part of Xfuzzy 3.0, a design environment for fuzzy logic
 * based systems.
 *
 * (c) 2000 IMSE-CNM. The authors may be contacted by the email address:
 *                    xfuzzy-team@imse.cnm.es
 *
 * Xfuzzy is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation.
 *
 * Xfuzzy is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

package xfuzzy.util;

import java.awt.*;

/**
 * Constantes comunes
 * 
 * @author Francisco Jos� Moreno Velo
 *
 */
public class XConstants {

	//----------------------------------------------------------------------------//
	//                           CONSTANTES P�BLICAS                              //
	//----------------------------------------------------------------------------//

	/**
	 * Nombre de la versi�n del entorno
	 */
	public static final String version = "Xfuzzy 3.5 beta 1";

	/**
	 * Fuente de letra para las etiquetas y botones
	 */
	public static final Font font = new Font("Dialog",Font.BOLD,11);
	
	/**
	 * Fuente de letra para los campos
	 */
	public static final Font textfont = new Font("Dialog",Font.PLAIN,11);

	/**
	 * Color de fondo para los campos de texto
	 */
	public static final Color textbackground = new Color(255,250,205);
	
	/**
	 * Color de fondo para el elemento seleccionado en una lista
	 */
	public static final Color textselectedbg = new Color(204,204,255);
	
	/**
	 * Color de fondo para la representaci�n del sistema
	 */
	public static final Color systembg = new Color(204,204,255);
	
	/**
	 * Color de fondo para las llamadas a bloques no difusos o bases de reglas
	 */
	public static final Color callbg = new Color(0,180,180);
	
	/**
	 * Color de fondo para la etiqueta de las llamadas
	 */
	public static final Color callnamebg = new Color(0,0,150);

	/**
	 * Fuente de letra para las barras de progreso
	 */
	public static final Font proggresfont = new Font("Dialog",Font.BOLD,12);

	/**
	 * Fuente de letra para las barras de progreso
	 */
	public static final Color proggresColorBackGround = new Color(255,255,255);

	/**
	 * Color de fondo para los jpanel secundarios del JFrame
	 */
	public static final Color jpanelColorBackground = new Color(235,235,235);

	//----------------------------------------------------------------------------//
	//                             M�TODOS P�BLICOS                               //
	//----------------------------------------------------------------------------//

	/**
	 * Verifica si una cadena corresponde a un identificador v�lido
	 */
	public static boolean isIdentifier(String name) {
		if(name.equals("")) return false;
		if(name.equals("operatorset")) return false;
		if(name.equals("type")) return false;
		if(name.equals("rulebase")) return false;
		if(name.equals("rulelist")) return false;
		if(name.equals("crisp")) return false;
		if(name.equals("extends")) return false;
		if(name.equals("using")) return false;
		if(name.equals("import")) return false;
		if(name.equals("if")) return false;
		if(name.equals("elseif")) return false;
		if(name.equals("else")) return false;
		if(name.equals("system")) return false;
		char [] namec = name.toCharArray();
		if(!Character.isLetter(namec[0]) && namec[0] != '_') return false;
		for(int i=1; i<namec.length; i++)
			if(!Character.isLetterOrDigit(namec[i]) && namec[i] != '_') return false;
		return true;
	}
}
